package org.example.qqrobot.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.qqrobot.model.pojo.User;

@Mapper
public interface UserMapper {

    @Select("select *from user where openid = #{openid}")
    User getByOpenid(String openid);

    @Insert("insert into user (openid, name, phone, hobby, idNumber, avatar, age, create_time) VALUES (#{openid}, #{name}, #{phone}, #{hobby}, #{idNumber}, #{avatar}, #{age}, #{createTime})")
    void insert(User user);


    @Select("select *from user where id = #{id}")
    User getById(Long id);



    void update(User user);

    @Select("select name from user where id = #{writer}")
    String getNameById(Long writer);
}
